<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var isIsomorphic = function (s, t) {
        if (s.length != t.length) return false;
        let mapping = new Map();
        for (let i = 0; i < s.length; i++) {
          if (mapping.has(s[i])) {
            if (mapping.get(s[i]) != t[i]) {
              return false;
            }
          } else {
            for(let [key,value] of mapping) {
                if(value === t[i]) {
                    return false
                }
            }
            mapping.set(s[i], t[i]);
          }
        }
       return true
      };
      console.log(isIsomorphic("egg", "foo"));
    </script>
  </body>
</html>
